'''
Created on 2011-12-19

@author: evil
'''
import httplib,sys

    
def main():
#    if len(sys.argv) <3:
#        print 'use python Test.py <host:port> <url> please!!'
#        return 2
        
    host = 'localhost:8080'#'mob.groupsgetter.com:80'#sys.argv[1];
    url = '/login'#'/pad/index.php/magazine'#sys.argv[2];
    
    print 'you request url is http://%s%s'%(host,url)
    
    conn = httplib.HTTPConnection(host)#"192.168.0.144:80"
#    url = "/pad/index.php/interfaces/user";
    
    conn.request("GET", url,headers={'imei':'testIMEI111','imsi':'testIMSI11','device_name':'Nesus One'})
  #  conn.request("GET", url,headers={'user_name':'macdw'})
    rsps = conn.getresponse()
    if rsps.status == 200:
        data = rsps.read()
        
        print rsps.getheaders()
        print unicode(data,'UTF-8')
    else:
        print rsps.status
            
    
    conn.close()
    
if __name__ == '__main__':main()
